import { getLayerTreeObject } from '@/utils/getInoByVedio'
import { useAirCityStore } from '@/stores/aircity'
import { personsSetting } from '../common'

let ele: any
let lastEvent: PointerEvent
const OnReady = async () => {
	__g.settings.setCampassVisible(false)
	__g.misc.setMainUIVisibility(false)

	const AirCityStore = useAirCityStore()

	/**
	 * 获取图层树
	 */
	await getLayerTreeObject()

	ele = document.querySelector('#player video')
	if (ele) {
		ele.onclick = (e: PointerEvent) => {
			if (e && e.stopPropagation) {
				e.stopPropagation()
			}
		}
	}
	await common_config.reset()
	init(AirCityStore)
	AirCityStore.setIsOnReady(true)
}

const init = (AirCityStore: any) => {
	fdapi.tileLayer.hide(AirCityStore.GetTreeIdByName(['fengtai_000', 'fengtai11_5']))

	//开启人流
	personsSetting.setSpeed(1)
	personsSetting.setTotal(100)

	fdapi.camera.set([12946565.104062, 4843476.616445, 313.921289, -13.066213, -126.80352, 0.000001], 0)
}
export default OnReady
